// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    arr: [],
    movies: [{
        url: '../../images/Rotating/3.jpg'
      },
      {
        url: '../../images/Rotating/news.png'
      },
      {
        url: '../../images/Rotating/1.jpg'
      },
      {
        url: '../../images/Rotating/2.jpg'
      }
    ],
  },

    search() {
      wx.switchTab({
        url: "../hall/hall"
      }) 
    },

  async onLoad() {
    var that = this;
    // const db = wx.cloud.database({ // 链接数据表
    //   env: "cloud1-0g9ywc7c46ef30ef"
    // });
    // db.collection('announcement').where({}).get({
        wx.request({
            url: 'http://116.62.156.149:7001/api/appList',
            method: "get",
      success: function (res) {
        console.log(res);
        let all = []
        // res.data 包含该记录的数据
        for (let i = 0; i < 4; i++) {
          all.push(res.data.data[i])
        }
        that.setData({
          arr: all,
        })
      }
    })
    wx.request({
      url: 'http://116.62.156.149:7001/api/lunbotu',
      method: "get",
success: function (res) {
  console.log(res);
  let all = []
  // res.data 包含该记录的数据
  for (let i = 0; i < 4; i++) {
    all.push(res.data[i])
  }
  console.log('all', all)
  that.setData({
    movies: all,
  })
}
})
  },

  navigator() {
    wx.reLaunch({
      url: "../hall/hall"
    })
  }
})